impl->device_cursor = g_hash_table_new_full (NULL, NULL,
NULL, g_object_unref);
impl->window_scale = 1;
+ impl->frame_sync_enabled = TRUE;
}
GdkToplevelX11 *
impl->toplevel->extended_update_counter,
impl->toplevel->current_counter_value);
- if (gdk_x11_screen_supports_net_wm_hint (gdk_window_get_screen (window),
+ if (impl->frame_sync_enabled &&
+ gdk_x11_screen_supports_net_wm_hint (gdk_window_get_screen (window),
gdk_atom_intern_static_string ("_NET_WM_FRAME_DRAWN")))
{
impl->toplevel->frame_pending = TRUE;
return impl->window_scale;
}
+/**
+ * gdk_x11_window_set_frame_sync_enabled:
+ * @window: (type GdkX11Window): a native #GdkWindow
+ * @frame_sync_enabled: whether frame-synchronization should be enabled
+ *
+ * This function can be used to disable frame synchronization for a window.
+ * Normally frame synchronziation will be enabled or disabled based on whether
+ * the system has a compositor that supports frame synchronization, but if
+ * the window is not directly managed by the window manager, then frame
+ * synchronziation may need to be disabled. This is the case for a window
+ * embedded via the XEMBED protocol.
+ *
+ * Since: 3.8
+ */
+void
+gdk_x11_window_set_frame_sync_enabled (GdkWindow *window,
+ gboolean frame_sync_enabled)
+{
+ /* Try to ensure the window has a native window */
+ if (!_gdk_window_has_impl (window))
+ gdk_window_ensure_native (window);
+
+ if (!GDK_WINDOW_IS_X11 (window))
+ {
+ g_warning (G_STRLOC " drawable is not a native X11 window");
+ return;
+ }
+
+ GDK_WINDOW_IMPL_X11 (window->impl)->frame_sync_enabled = FALSE;
+}
+
static void
gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass)
{
* unset during resizing and scaling */
guint override_redirect : 1;
guint frame_clock_connected : 1;
+ guint frame_sync_enabled : 1;
cairo_surface_t *cairo_surface;
void gdk_x11_window_set_user_time (GdkWindow *window,
guint32 timestamp);
+void gdk_x11_window_set_frame_sync_enabled (GdkWindow *window,
+ gboolean frame_sync_enabled);
GdkToplevelX11 *_gdk_x11_window_get_toplevel (GdkWindow *window);
void _gdk_x11_window_tmp_unset_bg (GdkWindow *window,
else /* If it's a passive plug, we use the root window */
gdk_window = gdk_window_new (gtk_widget_get_root_window (widget),
&attributes, attributes_mask);
+ /* Because the window isn't known to the window manager,
+ * frame sync won't work. In theory, XEMBED could be extended
+ * so that embedder did frame sync like a window manager, but
+ * it's just not worth the effort considering the current
+ * minimal use of XEMBED.
+ */
+ gdk_x11_window_set_frame_sync_enabled (gdk_window, FALSE);
gtk_widget_set_window (widget, gdk_window);
gdk_display_sync (gtk_widget_get_display (widget));